package kr.saeildamil.androidstudy.example02;

import kr.saeildamil.androidstudy.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class ButtonEventEx extends Activity {
	class MyListenerClass implements OnClickListener{

		@Override
		public void onClick(View v) {
			Toast.makeText(ButtonEventEx.this, "1버튼이 눌려졌음", Toast.LENGTH_SHORT).show();
			
		}
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ex2_buttoneventex);
		
		Button btn1 = (Button)findViewById(R.id.ex2_button01);
		btn1.setOnClickListener(new MyListenerClass());
		
		Button btn2 = (Button)findViewById(R.id.ex2_button02);
		btn2.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Toast.makeText(ButtonEventEx.this, "2버튼이 눌려졌음", Toast.LENGTH_SHORT).show();
				
			}
		});
	}
	
	public void myClickListener(View v){
		Toast.makeText(ButtonEventEx.this, "3버튼이 눌려졌음", Toast.LENGTH_SHORT).show();
	}
}
